package org.llc.gof.behavior.state.basic;

/**
 * @author Fancy
 */
public class Context {

	public final static State STATE1 = new ConcreteState1();

	public final static State STATE2 = new ConcreteState2();

	/**
	 * 当前状态
	 */
	private State CurrentState;

	/**
	 * 获得当前状态
	 */
	public State getCurrentState() {
		return CurrentState;
	}

	/**
	 * 设置当前状态
	 */
	public void setCurrentState(State currentState) {
		this.CurrentState = currentState;
		//切换状态
		this.CurrentState.setContext(this);
	}

	/**
	 * 行为委托1
	 */
	public void handle1(){
		this.CurrentState.handle1();
	}

	/**
	 * 行为委托2
	 */
	public void handle2(){
		this.CurrentState.handle2();
	}
}
